<?php
error_log('-->'.var_export($_SERVER, true));
$requestUrl = $_SERVER['REQUEST_URI'];
if (isset($_SERVER['HTTP_REFERER'])) {
    $referer = $_SERVER['HTTP_REFERER'];
    $hostEditUrl = 'http://localhost/abtester/edit/';
    $editUrl = substr($referer, strlen($hostEditUrl));

    error_log('#######'.$editUrl.$requestUrl);
    $redirect = $editUrl.$requestUrl;

    //header("location: $redirect");
} else {
    echo "Page not found.";
}
exit;